package com.wei800.turnover.config.druid;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class DruidDataSourceConfiguration { // 自定义的Druid配置类
    @Bean("vlaibaoDataSource")  		// 通过名称区分数据源
    @ConfigurationProperties(prefix = "spring.datasource.vlaibao")
    public DataSource vlaibaoDataSource() {
        return DruidDataSourceBuilder.create().build();
    }
    @Bean("vlaibao_dicDataSource") 			// 通过名称区分数据源
    @ConfigurationProperties(prefix = "spring.datasource.vlaibao-dic")
    public DataSource vlaibao_dicYootkDataSource() {
        return DruidDataSourceBuilder.create().build();
    }
    @Bean("vlaibao_websitetrafficDataSource") 			// 通过名称区分数据源
    @ConfigurationProperties(prefix = "spring.datasource.vlaibao-websitetraffic")
    public DataSource vlaibao_websitetrafficDataSource() {
        return DruidDataSourceBuilder.create().build();
    }
}
